package pro.lingwu.rainbowmall.config

import com.alibaba.druid.support.http.StatViewServlet
import org.springframework.boot.web.servlet.ServletRegistrationBean
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration

/**
 * This class will configure the 'druid database connection pool'.
 * Using this configuration to register the druid state management page.
 *
 * @author lingwu
 */
@Configuration
class DruidConfig {

    @Bean fun statViewServlet() =
        ServletRegistrationBean(StatViewServlet(), "/druid/*")
            .apply {
                addInitParameter("allow", "127.0.0.1")
                addInitParameter("deny", "")
                addInitParameter("loginUsername", "lingwu")
                addInitParameter("loginPassword", "yxpbsqq@741")
            }

}